<!DOCTYPE html>
<html lang="zh-CN" ng-app='he'>
	<head>
		<meta charset='utf-8' />
	
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>剩余假期查询</title>
		
		<script type="text/javascript">
			is_local='{{local}}';
			function loadcss(cssfile) {
		        document.write('\<link rel="stylesheet" href="' + cssfile +'" type="text/css"/\>');
		    }
			function loadjs(script_filename) {
		        document.write('\<script language="javascript" type="text/javascript" src="' + script_filename + '"\>\</script\>');
		    }
		    if(!is_local){
			    static_url='/static';
		    }else{
			    static_url='../../../../static';
		    }
		    // 加载所有微信页面需要的js和css
		    loadjs(static_url+'/js/weixin_page.js')
		</script>
		<script type="text/javascript">
			var app = angular.module('he',['ngSanitize']);
				app.config(function($interpolateProvider) {
				  $interpolateProvider.startSymbol('[[');
				  $interpolateProvider.endSymbol(']]');
				});
			app.controller('content',function ($scope,$http) {
				// 设置body里面的变量
				if(is_local){
					$scope.leave={
						annual_left:3.4,
						annual_base:7,
						this_annual_accum:0.35,
						last_annual_left:2.3,
						used_annual:1,
						swap_left:23,
						swap_expire:10,
					};
				}else{
					// 从服务器初始化
					var post_url='/attendance/ajax/';
					$scope.loading=true;
					function init_from_server() {
							var post_data = {
									leave_query:{},
								};  
							$http.post(post_url,post_data)
							.success(function(data, status, headers, config) { 
								$scope.leave=data.leave_query
								$scope.loading=false;
							}).error(function(data, status, headers, config) {  
							    //处理错误 
							    $scope.std='有错误,返回码为:'+status;
							});
					}
					init_from_server();
				}
				$scope.goto_applyleave=function () {
					location='leave_apply.html'
				}
			})
		</script>
	</head>
	<body ng-controller='content' ng-show='!loading'>
		<!-----------------在这里填写内容------------------------>
		<div class="container">
	    <div class="row">
	        <div class="col-xs-12 clear">
	            <p class="remaining">Your annual leave remaining <i ng-bind='leave.annual_left'>2</i> days</p>
	        </div>
	        <div class="col-xs-12 clear">
	            <p class="tagGroup">This year's annual leave</p>
	            <p class="days"><span ng-bind='leave.annual_base ||"loading..."'></span> days</p>
	            <p class="tagGroup">This year has been accumulated</p>
	            <p class="days"><span ng-bind='leave.this_annual_accum ||"loading..."'>...</span> days</p>
	            <p class="tagGroup">Last year has left annual</p>
	            <p class="days"><span ng-bind='leave.last_annual_left ||"loading..."'>...</span> days</p>
	            <p class="tagGroup">Have used annual leave</p>
	            <p class="days"><span ng-bind='leave.used_annual ||"loading..."'>...</span> days</p>
	            <p class="tagGroup">The rest of the paid leave the number of hours</p>
	            <p class="days"><span ng-bind='leave.swap_left ||"loading..."'>...</span> hours</p>
	            <p class="tagGroup">The expire hours</p>
	            <p class="days"><span ng-bind='leave.swap_expire ||"loading..."'>...</span> hours</p>
	            <p class="tagGroup">You can either</p>
	            <div class="tips">
	                <span class="point"></span>
	            </div>
	            <div class="btnBox">
	                <button type="button" class="btn btn-default" style="margin: 0" ng-click='goto_applyleave()'>LEAVE APPLICATION</button>
	            </div>
	        </div>
		    </div>
		</div>
		
		<!-----------------弹出框------------------------>
		<div ng-include src='"info_panel.html"'></div>
		
	</body>
</html>